From: Jim Porter Date: Sun, 13 Mar 2022 14:36:37 +0000 (+0100) Subject: Fix evaluation of negated argument predicates in Eshell X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~16^2~2370^2~1147 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=ea3c147d2dcb65840ad5ec5c4d8786d36a5ea0dc;p=emacs.git Fix evaluation of negated argument predicates in Eshell * lisp/eshell/em-pred.el (eshell-add-pred-func): Let-bind 'pred' so the lambdas see the original value (bug#54369). --- diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index 216c71f59e4..970329e12a9 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el @@ -360,12 +360,12 @@ resultant list of strings." (defun eshell-add-pred-func (pred funcs negate follow) "Add the predicate function PRED to FUNCS." - (if negate - (setq pred (lambda (file) - (not (funcall pred file))))) - (if follow - (setq pred (lambda (file) - (funcall pred (file-truename file))))) + (when negate + (setq pred (let ((pred pred)) + (lambda (file) (not (funcall pred file)))))) + (when follow + (setq pred (let ((pred pred)) + (lambda (file) (funcall pred (file-truename file)))))) (cons pred funcs)) (defun eshell-pred-user-or-group (mod-char mod-type attr-index get-id-func)